package com.hjs.security;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Jie extends HttpServlet {
    public Jie() {
        super();
    }
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doPost(request, response);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String mi = request.getParameter("mi");
        String key = request.getParameter("key");
        System.out.println("解密数据:" + mi);
        String b="";
        try {
            b = DesString.decrypt(mi, key);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("解密后的数据:" + b);
        request.setAttribute("jiem", b);
        request.getRequestDispatcher("/string.jsp").forward(request, response);
    }
    public void init() throws ServletException {
    }
}

